package com.labichaoka.chaoka.ui.record;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.labichaoka.chaoka.R;
import com.labichaoka.chaoka.entity.OrderListResponse;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by ruan on 2018/7/26.
 */

public class BorrowOrderAdapter extends BaseQuickAdapter<OrderListResponse.DataBean.OrderLoanMoneyListBean,BaseViewHolder> {
    private Typeface iconfont;
    private Context mContext;

    public BorrowOrderAdapter(Context context, List<OrderListResponse.DataBean.OrderLoanMoneyListBean> data) {
        super(R.layout.item_order,data);
        mContext=context;
        iconfont= Typeface.createFromAsset(context.getAssets(), "iconfont/iconfont.ttf");
    }


    @Override
    protected void convert(BaseViewHolder helper, OrderListResponse.DataBean.OrderLoanMoneyListBean item) {
        helper.setText(R.id.title, "订单总额(元)");
        helper.setText(R.id.order_id, item.getOrderNo());
        helper.setText(R.id.time, item.getToLoadMoneyTime());
        helper.setText(R.id.total, item.getOrderSumAmount());
        helper.setText(R.id.status, item.getViewDto().getViewDesc());
        helper.setTypeface(R.id.next, iconfont);

        int viewCode = item.getViewDto().getViewCode();
        if (viewCode == 1 || viewCode == 4|| viewCode == 8) {
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.font_ff4340));
        }else if(viewCode==2||viewCode==5){
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.font_16d690));
        }else if(viewCode==3||viewCode==10){
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.mainColor));
        }else if(viewCode==6||viewCode==7||viewCode==9){
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.font_999999));
        }
    }

    @Override
    public void onViewRecycled(BaseViewHolder holder) {
        super.onViewRecycled(holder);
    }
}



